<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="telephone=no" name="format-detection"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable = no"/>
    <title>{$data.goods_name}-{$webseting.web_title}</title>
    <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/product.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/pop.css"  rel="stylesheet">

</head>
<body>
<!--绑定头部-->
<include file="Public/binding_head"/>
<!--绑定头部-->
<header id="header" class="u-header clearfix">
    <div class="u-hd-left f-left">
        <a href="javascript:history.go(-1);" class="J_backToPrev"><span class="u-icon-px i-hd-back"></span></a>
    </div>
    <div class="u-hd-tit"><span>商品详情</span></div>
    <div class="u-hd-right f-right"><a href="{:U('wap/upgrade/upgrade_goods')}" mars_sead="nav_home_btn"><span
            class="u-icon-m i-hd-home"></span></a></div>
</header>

<div id="pLayout">
    <div class="new-wt">
        <div class="miblebox">
            <div class="slider">
                <ul>
                    <li><a href="javascript:void(0);" target="_blank"><img id="img_url" src="{$data.goods_img}" alt=""></a>
                    </li>
                    <!--<volist name="good_image_url" id="vo">-->
                    <!--<li><a href="javascript:void(0);" target="_blank"><img src="{$vo.img_url}" alt=""></a></li>-->
                    <!--</volist>-->
                </ul>
            </div>
            <div class="pd_product-title-wrap">
                <div class="pd_product-title-box">
                    <h2 class="pd_product-title" id="pd_product-title" title="">{$data.goods_name}</h2>

                    <h3 class="pd_product-subtitle" id="pd_product-subtitle" title="">{$data.goods_brief}</h3>

                    <div class="pd_product-price" id="current_price">
                        <span class="pd_product-price-yen">¥</span>
                        <strong class="pd_product-price-num ">{$data.shop_price}</strong>
                        <del style="text-decoration: line-through; color:#999; <if condition=" $data[
                        'hot_type'] neq 1">display: none;</if>" >￥{$data.market_price}</del>
                    </div>
                </div>

            </div>
            <if condition="$data['hot_type'] eq 1">
                <div class="pd_product-title-wrap">
                    <div class="pd_product-title-box">
                        <h2 class="pd_product-title" title="">{$data['hot_name']}</h2>

                        <h3 class="pd_product-subtitle" title="">
                            <div class="counter" id="divdown1" start_time="{$data['start_time']*1000}"
                                 end_time="{$data['end_time']*1000}" promote_status="{$data['promote_status']}"
                                 promote_msg="{$data['promote_msg']}" promote_tip="{$data['promote_tip']}"
                                 is_end_promote_sale="<if condition=" $data[
                            'promote_status'] lt 0">0
                            <else/>
                            {$data['is_end_promote_sale']}
            </if>
            ">
            <span>-</span>
            <span>-</span> 天
            <span>-</span>
            <span>-</span> 时
            <span>-</span>
            <span>-</span> 分
            <span>-</span>
            <span>-</span> 秒
            <span class="msec">1</span>
        </div>
        </h3>
    </div>
</div>
</if>
</div>
<div class="miblebox">
    <dl class="list-entry" style="position: relative;">
        <dt class="row01">
            <span class="col01">当前选择：</span>
                        <span class="col02 now_ch">
                            1 件
                        </span>
        </dt>

        <dd class="row02">

            <volist name="goods_attr1" id="vo">
                <section class="select" id="proColor">
                    <p class="label"> {$vo.attr_name}: </p>

                    <p class="option  choice_option">
                        <volist name="vo['tree']" id="voo">
                            <a href="javascript:void(0);" title="{$voo.attr_value}" data="{$vo.attr_name}"
                               data-attr="{$voo.attr_id}" data-attr-goods="{$voo.goods_attr_id}"
                               data-price="{$voo.attr_price|default='0'}"
                               class="link-check attr_chk attr_id_{$voo.attr_id} good_attr_{$voo.goods_attr_id}">{$voo.attr_value}</a>&nbsp;
                        </volist>
                    </p>
                </section>
            </volist>


            <section class="select" style="display: inline-block;">
                <p class="label">数量</p>

                <p class="option">
                    <if condition="$data['hot_type'] eq 1 && $data['promote_status'] egt 0">
                        <!--   <a class="btn-del  " style="background-position: 9px -20px;">-</a>
                        <input type="text" data="{$data.goods_id}" name="good_num" class="fm-txt good_num" value="1" id="number" readonly="readonly">
                        <a class="btn-add " id="plus">+</a> -->
                        <a class="btn-del  save_good" style="background-position: 9px -20px;">-</a>
                        <input type="text" data="{$data.goods_id}" name="good_num" class="fm-txt good_num" value="1"
                               id="number" readonly="readonly">
                        <a class="btn-add add_good" id="plus">+</a>
                        <else/>
                        <a class="btn-del  save_good" style="background-position: 9px -20px;">-</a>
                        <input type="text" data="{$data.goods_id}" name="good_num" class="fm-txt good_num" value="1"
                               id="number" readonly="readonly">
                        <a class="btn-add add_good" id="plus">+</a>
                    </if>
                </p>
            </section>
        </dd>
        <dt class="row02">
            <section class="select" style="display: inline-block;">
                <span class="col01">价格：</span>
                <span class="pd_product-price-yen">¥</span>
                <span class=' pd_product-price-num goods_price'>{$data.shop_price}</span><br/><br/>
                <!--<span style="color: #FDFBFB;background-color: #000;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;">&nbsp;&nbsp;&nbsp;{$data.shipping_name}&nbsp;&nbsp;&nbsp;</span>-->
                <if condition="$data.goods_browse gt 0">
                    <div style="margin-top:10px;    width: 94px;">&nbsp;销量:{$data.goods_browse}</div>
                </if>
            </section>
        </dt>
        <!-- S 联系我们 -->
        <div style="margin-top:10px; text-align: center;">
            <p>
            <dl class="list-entry">
                <dt class="con-inf">
                    <a href="tel:023-67862417"><i class="phone"></i>客服电话</a>
                    <a href="http://wpa.qq.com/msgrd?v=3&uin=2965228802&site=qq&menu=yes"><i class="kqq"></i>客服QQ</a>
                </dt>
            </dl>
        </div>
        <!-- E 联系我们 -->
        <div class="main_goods_share_open"
             style="position: absolute;right: 0px;width: 25px;height: 35px;z-index: 20; top: 15px;transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);">
            <img src="__PUBLIC__/wap/img/goods_share.png">
        </div>
    </dl>
    <if condition="!empty($goods_attr)">
        <dl class="list-entry">
            <dt class="row01">
                <span class="col01">参数：</span>
                        <span class="col02">
                            <ul class="list-saleinfo">
                                <volist name="goods_attr" id="vo">
                                    <if condition="!empty($vo['attr_value'])">
                                        <li><span class="txt01">{$vo.attr_name}：{$vo.attr_value}</span></li>
                                    </if>
                                </volist>
                            </ul>
                        </span>
            </dt>
        </dl>
    </if>
    <!-- <dl class="list-entry">
        <dt class="row01">
            <span class="col01">运费：</span>
            <span class="col02">店铺单笔订单不满39元，收运费5元</span>
        </dt>
    </dl> -->
    <dl class="list-entry">
        <div class="detail">
            <p class="Wz"><label>客服电话</label><a href="javascript:void(0)">023-67862417</a></p>

            <p class="Wz"><label>客服QQ</label><a href="javascript:void(0)">2965228802</a></p>

            <p class="Wz"><label>官方网址</label><a href="javascript:void(0)">www.fenggoo.com</a></p>
        </div>
        <dt class="row01 unite-font-size">
            <a href="＃" id="wareInfo">
                <span class="col01">商品详情</span>
            </a>
        </dt>

        <div class="detail">
            {$data.goods_desc}
        </div>
    </dl>
</div>
</div>
</div>
<div class="main main_goods_share" style="display:none;">
    <div class="content">
        <div class="share">
            <div class="share_top">
                <div class="share_left">
                    <label>方法一：</label>
                </div>
                <div class="share_right">
                    <p>点击右上角<i><img src="__PUBLIC__/wap/img/shar.png"/></i>图标</p>

                    <p>然后<i><img src="__PUBLIC__/wap/img/zf.png"/></i>发送给朋友</p>

                    <p>或<i class="img_margin"><img src="__PUBLIC__/wap/img/py.png"/></i>分享到朋友圈</p>
                </div>
            </div>
            <div class="share_footer">
                <div class="share_left">
                    <label>方法二：</label>
                </div>
                <div class="share_right">
                    <p>邀请好友免费注册，分享可赚取佣金哦！</p>
                </div>
            </div>
        </div>

        <div class="footer">
            <img src="__PUBLIC__/wap/img/goods_share_know.png" class="main_goods_share_close layui-layer-close "
                 style="position: static;"/>

            <!--  <input type="button" value="知道了" class="main_goods_share_close layui-layer-close layui-layer-close1" /> -->
        </div>
    </div>
</div>

<div class="bottom-to-top"
     style="display: block; bottom: 106px;transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);">
    <img src="__PUBLIC__/wap/img/scroll-to-top-icon.png" style="width: 100%;">
</div>
<div style="height:88px;">
</div>
<!-- <div class="cart_btn for_gaq" data-for-gaq="进入购物车;详情页" style="right: 10px;"><span class="num">1</span></div> -->
<div id="cart1" class="cart-btns-fixed" style="display: table;">
    <div class="cart-btns-fixed-box">
        <!--<a class="btn btn-cart" style="width:140px;" id="add_cart">加入购物车</a>-->
        <a class="btn btn-buy " style="width:100px;" id="directorder">立即购买</a>
    </div>
</div>
<!--end top-->
<include file="Public/footer"/>
<include file="Public/wap_javascript"/>
<script type="text/javascript">
    var binding_is_check = 0;// 重复再次弹出 1是 0否
    var binding_page = 'goods_goods_detail';// //当前页面名称 不可重复
</script>
<!--绑定-->
<include file="Public/binding_phone"/>
<!--绑定-->
<!--end 页脚-->
<input type="hidden" name="goods_id" value="{$data.goods_id}">
<input type="hidden" name="goods_attr_id" value="">
<input type="hidden" name="share" value="{$_GET['share']}">
<input type="hidden" name="goods_price" value="{$data.shop_price}">
<!--<script src="__PUBLIC__/bootstrap/vendor/jquery/jquery.min.js"></script>-->
<!--<script type="text/javascript" src="__PUBLIC__/wap/js/yxMobileSlider.js"></script>-->
<script type="text/javascript" src="__PUBLIC__/wap/js/jquery.fly.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/wap/js/yxMobileSlider.js"></script>
<script>
    $(".slider").yxMobileSlider({width: 630, height: 640, during: 3000})
</script>
<!-- $('.go_pay').css('cssText','background-color:rgb(171, 168, 168) !important;'); -->


<script type="text/javascript">
    //    $(function () {
    //        //加入购物车
    //        $(function () {
    //            var winW = $(window).width() + $('.contact').width() / 2;   //抛物体终点横坐标偏移所需像素
    //            var winH = $(window).height() / 2;   //抛物体起点纵坐标偏移所需像素
    //            var offset = $(".contact").offset();
    //            $("#add_cart").click(function (event) {
    //                var goods_id = $('input[name="goods_id"]').val();
    //                var goods_attr_id = $('input[name="goods_attr_id"]').val();
    //                var goods_num = $('input[name="good_num"]').val();
    //                var share = $('input[name="share"]').val();
    //                var img = $('#img_url').attr('src');       //获取当前点击图片链接
    //
    //                $.ajax({
    //                    url: "{:U('wap/cart/add_cart')}",
    //                    type: 'get',
    //                    data: {goods_id: goods_id, goods_attr_id: goods_attr_id, goods_num: goods_num, share: share},
    //                    dataType: 'json',
    //                    success: function (data) {
    //                        if (data.status == 1) {
    //                            layer.msg('加入成功', {icon: 6});
    //
    //                            var flyer = $('<img style="display:block;width:50px;height:50px;border-radius:50px;position: fixed;z-index: 9999;" src="' + img + '">');      //抛物体对象
    //                            flyer.fly({
    //                                start: {
    //                                    left: event.screenX,       //抛物体起点横坐标
    //                                    top: event.screenY - winH,        //抛物体起点纵坐标
    //                                },
    //                                end: {
    //                                    left: winW - offset.left,         //抛物体终点横坐标
    //                                    top: offset.top,       //抛物体终点纵坐标
    //                                },
    //                                onEnd: function () {
    //
    //                                    this.destory();//销毁抛物体
    //                                }
    //                            });
    //
    //                            //alert("加入成功");
    //                        } else {
    //                            //alert(data.error)
    //                            layer.msg(data.error, {icon: 5});
    //                        }
    //                    }
    //                });
    //
    //            });
    //
    //        });
    //立即购买
    $('#directorder').click(function () {
        var goods_id = $('input[name="goods_id"]').val();
        var goods_attr_id = $('input[name="goods_attr_id"]').val();
        var goods_num = $('input[name="good_num"]').val();
        var share = $('input[name="share"]').val();
        var url = "<?php echo U('Wap/cart/upgrade_order_add'); ?>?goods_id=" + goods_id + '&goods_attr_id=' + goods_attr_id + '&goods_num=' + goods_num;
        window.location.href = url;
    });
    //收藏
    $("#pd_product-collect").click(function () {
        var _this = $(this);
        var goods_id = _this.attr('data');
        var type = _this.attr('data-type');
        $.ajax({
            url: "{:U('wap/goods/goods_collect')}",
            type: 'post',
            data: {goods_id: goods_id},
            dataType: 'json',
            success: function (data) {
                if (data.status == 1) {
                    if (type > 0) {
                        layer.msg('取消收藏成功', {icon: 6});
                        //alert("取消成功")
                        $(".collect_text").html('收藏');
                        _this.attr('data-type', 0);
                        _this.removeClass('pd_product-collect_1');
                        var sc = parseInt($('#detailFavNums').html());
                        $('#detailFavNums').html(sc - 1);
                    } else {
                        //alert("收藏成功")
                        layer.msg('收藏成功', {icon: 6});
                        $(".collect_text").html('已收藏');
                        _this.addClass('pd_product-collect_1');
                        _this.attr('data-type', 1)
                        var sc = parseInt($('#detailFavNums').html());
                        $('#detailFavNums').html(sc + 1);
                    }
                } else {
                    layer.msg(data.error, {icon: 5});
                    //alert(data.error)
                }
            }
        });
    });
    //增加数量
    $(".add_good").click(function () {
        var _this_num = $(".good_num");
        var goods_num = _this_num.val();
        goods_num++;
        _this_num.val(goods_num)
        //显示当前选择
        set_now_chk();
        //计算商品价格
        get_goods_price();
    });
    //减少数量
    $(".save_good").click(function () {
        var _this_num = $(".good_num");
        var goods_num = _this_num.val();
        goods_num--;
        if (goods_num <= 0) {
        } else {
            _this_num.val(goods_num)
        }
        //显示当前选择
        set_now_chk();
        //计算商品价格
        get_goods_price();

    });
    //属性选择
    $(".attr_chk").click(function () {
        var _this = $(this);
        var attr_id = _this.attr('data-attr');
        $('.attr_id_' + attr_id).css('cssText', "");
        $('.attr_id_' + attr_id).removeClass('now_chk');
        //$('.go_pay').css('cssText','background-color:rgb(171, 168, 168) !important;');
        _this.css('cssText', 'border: 1px solid red;');
        _this.addClass('now_chk');
        //显示当前选择
        set_now_chk();
        //计算商品价格
        get_goods_price();

    });
    $(".go_pay").click(function () {
        var _this_num = $(".good_num");
        var all_num = _this_num.val();
        all_num = parseInt(all_num);
        if (all_num > 0) {
            var good_id = $("input[name='goods_id']").val();
            var shop_id = $("input[name='shop_id']").val();
            var url = "<?php echo U('Wap/order/order_add'); ?>?good_id=" + good_id + '|' + all_num + "&shop_id=" + shop_id;
            window.location.href = url;
        }
    });
    function set_now_chk() {
        var text = "";
        if ($(".now_chk").length) {
            $(".now_chk").each(function () {
                var data = $(this).attr('data');
                var title = $(this).attr('title');
                text += data + ":" + title + '&nbsp;&nbsp;';
            });
        }
        var num = $(".good_num").val();
        text += '&nbsp;&nbsp;' + num + "件"
        $('.now_ch').html(text);
    }
    //计算商品价格
    function get_goods_price() {

        var goods_price = $('input[name="goods_price"]').val();
        goods_price = parseFloat(goods_price);
        var goods_attr_id = '';
        /*  if($(".now_chk").length){
         $(".now_chk").each(function(){
         var data_price=$(this).attr('data-price');
         data_price=data_price?data_price:0;
         var data_attr=$(this).attr('data-attr-goods');
         data_price=parseFloat(data_price);
         goods_price=goods_price+data_price;
         goods_attr_id=goods_attr_id+','+data_attr;
         });
         }*/
        var goods_price_arr = new Array()
        if ($(".now_chk").length) {
            $(".now_chk").each(function (i) {
                var data_price = $(this).attr('data-price');
                data_price = data_price ? data_price : 0;
                var data_attr = $(this).attr('data-attr-goods');
                goods_price_arr[i] = parseFloat(data_price);
                goods_attr_id = goods_attr_id + ',' + data_attr;
            });
        }
        goods_price_arr = Math.max.apply(null, goods_price_arr);//最大值
        // goods_price=goods_price+data_price;
        if (goods_price_arr > 0) {
            goods_price = goods_price_arr;
        }
        if (goods_attr_id) {
            goods_attr_id = goods_attr_id.substr(1);
        }
        $('input[name="goods_attr_id"]').val(goods_attr_id);
        var total = parseFloat(0);
        var all_num = 0;
        var goods_id_str = '';
        $(".good_num").each(function () {
            var num = $(this).val();
            num = parseInt(num);
            if (num > 0) {
                var goods_id = $(this).attr('data');
                total = total + goods_price * num;
                goods_id_str = goods_id_str + ',' + goods_id + '|' + num;
                all_num = all_num + num;
            }
        });
        if (goods_id_str) {
            goods_id_str = goods_id_str.substr(1);
        }
        total = total.toFixed(2)
        if (total > 0) {
            $('.go_pay').removeAttr('style');
        } else {
            $('.go_pay').css('cssText', 'background-color:rgb(171, 168, 168) !important;');
        }
        $('.goods_price').html(total);
        //$('.all_price').html('￥'+total);
        //$('.total').html(total);
        //var discount_price=discount_consume*total;
        //discount_price=discount_price.toFixed(2);

        //$('input[name="goods_id"]').val(goods_id_str);
        //$('.all_num').html(all_num);
    }
</script>
<!--微信分享-->
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    //微信分享后执行的结果
    function getShare() {
        var goods_id = $('input[name="goods_id"]').val();
        $.ajax({
            url: "{:U('wap/upgrade/goods_detail')}",
            data: "goods_id=" + goods_id,
            type: 'post',
            dataType: "json",
            success: function (re) {
                if (re.status == 1) {
                    layer.msg('分享成功', {icon: 6});
                } else {
                    layer.msg('分享失败', {icon: 5});
                }
            }
        })
    }
    $(function () {
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: '<?php echo $appid; ?>', // 必填，公众号的唯一标识
            timestamp: '<?php echo $time; ?>', // 必填，生成签名的时间戳
            nonceStr: '<?php echo $noncestr; ?>', // 必填，生成签名的随机串
            signature: '<?php echo $signature; ?>',// 必填，签名，见附录1
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        });
    });

    wx.ready(function () {
        wx.onMenuShareTimeline({
            title: '<?php echo $shar_title; ?>', // 分享标题
            link: '<?php echo $shar_url; ?>', // 分享链接
            imgUrl: '<?php echo $shar_imgurl; ?>', // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数
                getShare();

            },
            cancel: function () {
                // 用户取消分享后执行的回调函数

            }
        });
        wx.onMenuShareAppMessage({
            title: '<?php echo $shar_title; ?>', // 分享标题
            desc: '<?php echo $shar_desc; ?>', // 分享描述
            link: '<?php echo $shar_url; ?>', // 分享链接
            imgUrl: '<?php echo $shar_imgurl; ?>', // 分享图标
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () {
                // 用户确认分享后执行的回调函数
                getShare();
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });

        wx.onMenuShareQQ({
            title: '<?php echo $data['goods_name']; ?>', // 分享标题
            desc: '<?php echo $shar_desc; ?>', // 分享描述
            link: '<?php echo $shar_url; ?>', // 分享链接
            imgUrl: '<?php echo $shar_imgurl; ?>', // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数
                getShare();
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });

        wx.onMenuShareWeibo({
            title: '<?php echo $shar_title; ?>', // 分享标题
            desc: '<?php echo $shar_desc; ?>', // 分享描述
            link: '<?php echo $shar_url; ?>', // 分享链接
            imgUrl: '<?php echo $shar_imgurl; ?>', // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数
                getShare();
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });

        wx.onMenuShareQZone({
            title: '<?php echo $shar_title; ?>', // 分享标题
            desc: '<?php echo $shar_desc; ?>', // 分享描述
            link: '<?php echo $shar_url; ?>', // 分享链接
            imgUrl: '<?php echo $shar_imgurl; ?>', // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数
                getShare();
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });


    });
    $(function () {
        $('.choice_option').each(function (index, e) {
            $(e).find('a:eq(0)').click();
        });
    });
</script>
<style>
    .layui-layer-demo {
        background: none !important;
        box-shadow: none !important;
        border-radius: 0px !important;
    }
</style>

<script type="text/javascript">
    var close_index;
    var close_index_this;
    $(function () {

        $('.main_goods_share_open').click(function () {
            //捕获页
            layer.open({
                type: 1,
                shade: 0.8,//透明度
                title: false, //不显示标题
                closeBtn: false, //不显示关闭按钮
                skin: 'layui-layer-demo', //样式类名
                shadeClose: true, //开启遮罩关闭
                area: ['100%', '100%'],
                content: $('.main_goods_share'), //捕获的元素
                cancel: function (index) {
                    close_index = index;
                    close_index_this = this;
                    layer.close(index);
                    this.content.show();
                    $('.main_goods_share').hide();
                    //layer.msg('捕获就是从页面已经存在的元素上，包裹layer的结构',{time: 5000});
                }
            });
        });
        /*$('.main_goods_share_clase').click(function(){
         layer.close(close_index);
         $('.main_goods_share').hide();
         });
         */
    });
</script>
</body>
</html>